/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.prashant.sqlduniya.sqlmanager;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Date;

/**
 *
 * @author prashant
 */
public class DBConnectionInfo {

    private String name;
    private String server;
    private int port;
    private Credential credential;
    private String catalog;
    private Date createdon;
    private boolean status;
    private transient PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private String url;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        String old = this.name;
        this.name = name;
        changeSupport.firePropertyChange("name", old, name);
    }

    public Date getCreatedon() {
        return createdon;
    }

    public void setCreatedon(Date createdon) {
        this.createdon = createdon;
    }

    public Credential getCredential() {
        return credential;
    }

    public void setCredential(Credential credential) {
        Credential old = this.credential;
        this.credential = credential;
        changeSupport.firePropertyChange("credential", old, credential);
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        int old = this.port;
        this.port = port;
        changeSupport.firePropertyChange("port", old, port);
    }

    public String getServer() {
        return server;
    }

    public void setServer(String server) {
        String old = this.server;
        this.server = server;
        changeSupport.firePropertyChange("server", old, server);
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        boolean old = this.status;
        this.status = status;
        changeSupport.firePropertyChange("status", old, status);
    }

    public String getCatalog() {
        return catalog;
    }

    public void setCatalog(String catalog) {
        String old = this.catalog;
        this.catalog = catalog;
        changeSupport.firePropertyChange("catalog", old, catalog);
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        String old = this.url;
        this.url = url;
        changeSupport.firePropertyChange("url", old, url);
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(
            PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

    @Override
    public String toString() {
        return "DBConnectionInfo{" + "name=" + name + ", server=" + server + ", port=" + port + ", catalog=" + catalog + '}';
    }
}
